from pyecharts.charts import Bar
from pyecharts.options import *

# 构建柱状图对象
bar = Bar()

# 添加x轴数据
bar.add_xaxis(["中国", "美国", "英国"])

# 添加y轴数据 ,数值标签放右侧
bar.add_yaxis("GDP", [30, 40, 10],
              label_opts=LabelOpts(
                  position="right"
              ))

# 反转x轴和y轴
bar.reversal_axis()

# 绘图
bar.render(path="基础柱状图.html")
